TalentSync

AI resume builder and ATS optimizer for job seekers. Tailored resumes, outreach, and interview prep from one profile.

Answer evaluation system

Scores interview answers on technical skill, communication, and fit signals. Supports plain and SSE streaming modes, and can fold in code-execution results for coding questions.

Repository layout#

The Answer Evaluation System spans several modules:

  • Services orchestrate the interview flow and evaluation logic.
  • Data prompts define the evaluation criteria and output formats.
  • Models encapsulate schemas for questions, answers, and evaluation results.
  • Routes expose APIs for submitting answers, streaming evaluations, and managing sessions.

Building blocks#

  • AnswerEvaluator: Orchestrates evaluation of textual answers and code submissions, parses structured outputs, and supports streaming responses.
  • InterviewGraph: Coordinates session lifecycle, question flow, and integrates evaluation and code execution.
  • SummaryGenerator: Produces detailed interview summaries with cultural fit and communication insights.
  • CodeExecutor: Safely executes candidate code and returns execution metrics for contextual evaluation.
  • SessionManager: Manages interview sessions and events in memory, tracking tab switches and integrity signals.
  • Prompts: Define evaluation rubrics and output formats for both evaluation and summary generation.
  • Schemas: Define data models for questions, answers, evaluation results, and session state.

How it fits together#

The system follows a layered architecture:

  • API Layer: FastAPI routes handle requests and stream responses.
  • Orchestration Layer: InterviewGraph manages state transitions and delegates tasks.
  • Evaluation Layer: AnswerEvaluator and SummaryGenerator produce structured results.
  • Execution Layer: CodeExecutor validates and runs candidate code.
  • Persistence Layer: SessionManager stores sessions and events.

AnswerEvaluator#

The AnswerEvaluator class encapsulates the evaluation logic:

  • Non-streaming evaluation: Builds a LangChain prompt with role, difficulty, topic, question, expected keywords, and candidate answer; invokes the LLM; parses JSON or markdown to produce an EvaluationResult.
  • Streaming evaluation: Formats a streaming prompt and yields tokens incrementally for SSE.
  • Code streaming: Uses a specialized prompt incorporating execution results (success, stdout/stderr, execution time) to provide code review feedback.
  • Parsing utilities: Extract structured fields (score, strengths, improvements) from both JSON and markdown outputs.

InterviewGraph#

InterviewGraph runs the interview flow:

  • Creates sessions, generates questions, and updates state upon answer submission.
  • Streams evaluation tokens to clients via SSE and parses final results.
  • Executes code, streams execution results, and then streams code review.
  • Generates final interview summaries with cultural fit and communication assessments.

SummaryGenerator#

The SummaryGenerator produces detailed interview summaries:

  • Calculates a final score as a percentage from question scores.
  • Formats questions and events for context.
  • Parses structured outputs (JSON or markdown) to extract strengths, weaknesses, recommendations, hiring recommendation, cultural fit notes, technical proficiency, and communication skills.

CodeExecutor#

The CodeExecutor safely executes candidate code:

  • Validates language support and enforces length limits.
  • Performs basic security checks to prevent dangerous patterns.
  • Runs code with timeouts and captures stdout/stderr.
  • Supports batch test execution and aggregates results.

SessionManager#

SessionManager maintains in-memory state for sessions and events:

  • Stores sessions and events keyed by session_id.
  • Tracks tab switches and other integrity events.
  • Provides CRUD operations and listing with filtering.

Dependencies#

The system splits work by layer:

  • Routes depend on InterviewGraph for orchestration.
  • InterviewGraph depends on AnswerEvaluator, CodeExecutor, SummaryGenerator, and SessionManager.
  • AnswerEvaluator and SummaryGenerator depend on prompt templates and LLM providers.
  • Models define the data contracts used across services.

Performance#

  • Streaming evaluation reduces perceived latency by delivering partial feedback incrementally.
  • Code execution timeouts and output truncation prevent resource exhaustion.
  • In-memory session storage simplifies deployment but requires persistence planning for production.
  • Prompt templates standardize evaluation criteria, aiding consistency across LLM invocations.

[No sources needed since this section provides general guidance]

Troubleshooting#

Common issues and mitigations:

  • Evaluation service unavailable: The system returns a neutral default score and feedback when the LLM provider is unreachable.
  • Parsing failures: The parser attempts JSON extraction first, falling back to markdown parsing; keep prompts producing one of these formats.
  • Streaming interruptions: SSE endpoints wrap errors into structured messages for client handling.
  • Session validation errors: The graph validates current question state and raises explicit errors if mismatched.
  • Code execution errors: Security checks and timeouts guard against malicious or excessive code; results include stderr for diagnostics.